<jtmpl:comment>
@version	$Id: mainconfig.html 14401 2010-01-26 14:10:00Z louis $
@package	Joomla
@subpackage	Installation
@copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
@license	GNU/GPL
</jtmpl:comment>

<script language="JavaScript" type="text/javascript">
<!--
	function validateForm( frm, task ) {

		var valid_site = document.formvalidator.isValid(frm, 'vars[siteName]');
		var valid_email = document.formvalidator.isValid(frm, 'vars[adminEmail]');
		var valid_password = document.formvalidator.isValid(frm, 'vars[adminPassword]');
		var confirm_password = document.formvalidator.isValid(frm, 'vars[confirmAdminPassword]');

		var siteName 				= getElementByName( frm, 'vars[siteName]' );
		var adminEmail 				= getElementByName( frm, 'vars[adminEmail]' );
		var adminPassword 			= getElementByName( frm, 'vars[adminPassword]' );
		var confirmAdminPassword 	= getElementByName( frm, 'vars[confirmAdminPassword]' );

		if (siteName.value == '' || !valid_site) {
			alert( '<jtmpl:translate key="warnSiteName" escape="yes">Please enter a site name</jtmpl:translate>' );
		} else if (this.document.filename.migstatus.value == '1' && this.document.filename.dataLoaded.value == '1') {
			submitForm( frm, task ); // Migration doesn't need email or admin passord
		} else if (adminEmail.value == '' || !valid_email) {
			alert( '<jtmpl:translate key="warnEmailAddress" escape="yes">Please enter a valid email address</jtmpl:translate>' );
		} else if (adminPassword.value == '' || !valid_password) {
			alert( '<jtmpl:translate key="warnAdminPassword" escape="yes">Please enter a valid admin password</jtmpl:translate>' );
		} else if (adminPassword.value != confirmAdminPassword.value || !confirm_password) {
			alert( '<jtmpl:translate key="warnAdminPasswordDoesntMatch" escape="yes">Admin password doesn\'t match the confirm admin password field</jtmpl:translate>' );
		} else {
			if (this.document.filename.dataLoaded.value == '1' || confirm( '<jtmpl:translate key="warnNoData" escape="yes">No sample data or other data installed. OK to continue. Cancel to redo this step</jtmpl:translate>' )) {
				submitForm( frm, task );
			} else {
				return;
			}
		}
	}

	function selectMode() {
		var frm = this.document.filename;
		if(frm.what_to_load[0].checked) {
			frm.instDefault.disabled = false;
			frm.sqlFile.disabled = true;
			frm.oldPrefix.disabled = true;
			frm.srcEncoding.disabled = true;
			frm.migrationLoad.disabled = true;
			frm.migration.disabled = true;
			frm.sqlUploaded.disabled = true;
		} else if(frm.what_to_load[1].checked) {
			frm.instDefault.disabled = true;
			frm.sqlFile.disabled = false;
			frm.oldPrefix.disabled = false;
			frm.srcEncoding.disabled = false;
			frm.migrationLoad.disabled = false;
			frm.migration.disabled = false;
			frm.sqlUploaded.disabled = false;
		}
	}

	function JDefault() {
		this.document.filename.dataLoaded.value = '1';
		xajax_instDefault(xajax.getFormValues('filename'));
	}

	function externalSql(frm, task) {

		if (frm.sqlFile.value == '') {
			alert( '<jtmpl:translate escape="yes">No file selected</jtmpl:translate>' );
			return;
		} else {
			frm.sqlupload.value = '1';
			frm.dataLoaded.value = '1';
			submitForm(frm, task);
		}
	}

	function migrationSql(frm, task) {

		if (frm.sqlFile.value == '' && !frm.sqlUploaded.checked) {
			alert( '<jtmpl:translate escape="yes">No file selected</jtmpl:translate>' );
			return;
		} else {
			frm.migrationupload.value = '1';
			frm.dataLoaded.value = '1';
			submitForm(frm, task);
		}
	}

	function clearPasswordFields(frm) {
		var adminPassword 			= getElementByName( frm, 'vars[adminPassword]' );
		var confirmAdminPassword 	= getElementByName( frm, 'vars[confirmAdminPassword]' );

		if( adminPassword.defaultValue == adminPassword.value || confirmAdminPassword.defaultValue == confirmAdminPassword.value ) {
			adminPassword.value 		= '';
			confirmAdminPassword.value 	= '';
		}
		return;
	}
//-->
</script>

<div id="right">
	<div id="rightpad">
		<div id="step">
			<div class="t">
		<div class="t">
			<div class="t"></div>
		</div>
		</div>
		<div class="m">
				<div class="far-right">
					<jtmpl:tmpl name="buttons" type="condition" conditionvar="direction">
						<jtmpl:sub condition="ltr">
							<div class="button1-right"><div class="prev"><a onclick="submitForm( adminForm, '{PREVIOUS}' );" alt="<jtmpl:translate escape="yes">Previous</jtmpl:translate>"><jtmpl:translate escape="yes">Previous</jtmpl:translate></a></div></div>
							<div class="button1-left"><div class="next"><a onclick="validateForm( adminForm, 'saveconfig' );" alt="<jtmpl:translate escape="yes">Next</jtmpl:translate>"><jtmpl:translate escape="yes">Next</jtmpl:translate></a></div></div>
						</jtmpl:sub>
						<jtmpl:sub condition="rtl">
							<div class="button1-right"><div class="prev"><a onclick="validateForm( adminForm, 'saveconfig' );" alt="<jtmpl:translate escape="yes">Next</jtmpl:translate>"><jtmpl:translate escape="yes">Next</jtmpl:translate></a></div></div>
							<div class="button1-left"><div class="next"><a onclick="submitForm( adminForm, '{PREVIOUS}' );" alt="<jtmpl:translate escape="yes">Previous</jtmpl:translate>"><jtmpl:translate escape="yes">Previous</jtmpl:translate></a></div></div>
						</jtmpl:sub>
					</jtmpl:tmpl>
				</div>
				<span class="step"><jtmpl:translate>Main Configuration</jtmpl:translate></span>
			</div>
		<div class="b">
		<div class="b">
			<div class="b"></div>
		</div>
		</div>
	</div>

	<div id="installer">
			<div class="t">
		<div class="t">
			<div class="t"></div>
		</div>
		</div>
		<div class="m">

			<form action="index.php" method="post" name="adminForm" id="adminForm" class="form-validate">
			<div id="installerpad">


		<div class="newsection"></div>
				<h2><jtmpl:translate>Site Name</jtmpl:translate>:</h2>
				<div class="install-text">
					<jtmpl:translate key="enterSiteName">Enter the name of your Joomla! site.</jtmpl:translate>
				</div>
				<div class="install-body">
				<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
			</div>
			<div class="m">
						<fieldset>
							<table class="content2">
								<tr>
									<td class="item">
									<label for="siteName">
										<span id="sitenamemsg"><jtmpl:translate>Site name</jtmpl:translate></span>
									</label>
									</td>
									<td align="center">
									<input class="inputbox validate required sitename sitenamemsg" type="text" id="siteName" name="vars[siteName]" size="30" value="{VAR_SITENAME}" />
									</td>
								</tr>
							</table>
						</fieldset>
			</div>
			<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
			</div>
					<div class="clr"></div>
				</div>

		<div class="newsection"></div>
				<h2><jtmpl:translate key="confTitle">Confirm the admin email and password</jtmpl:translate></h2>
				<div class="install-text">
					<jtmpl:translate key="tipConfSteps">
					<p>Enter your e-mail address, this will be the e-mail address of the site
					Super Administrator. If you are migrating you can ignore this section.</p></jtmpl:translate>
				</div>
				<div class="install-body">
				<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
			</div>
			<div class="m">
						<fieldset>
							<table class="content2">
							<tr>
								<td class="item">
								<label for="adminEmail">
									<span id="emailmsg"><jtmpl:translate>Your E-mail</jtmpl:translate></span>
								</label>
								</td>
								<td align="center">
								<input class="inputbox validate required email emailmsg" type="text" id="adminEmail" name="vars[adminEmail]" value="" size="30" />
								</td>
							</tr>
							<tr>
								<td class="item">
								<label for="adminPassword">
									<span id="passwordmsg"><jtmpl:translate>Admin password</jtmpl:translate></span>
								</label>
								</td>
								<td align="center">
								<input onfocus="clearPasswordFields( adminForm );" class="inputbox validate required password passwordmsg" type="password" id="adminPassword" name="vars[adminPassword]" value="" size="30"/>
								</td>
							</tr>
							<tr>
								<td class="item">
								<label for="confirmAdminPassword">
									<span id="confirmpasswordmsg"><jtmpl:translate>Confirm admin password</jtmpl:translate></span>
								</label>
								</td>
								<td align="center">
								<input class="inputbox validate required confirmpassword confirmpasswordmsg" type="password" id="confirmAdminPassword" name="vars[confirmAdminPassword]" value="" size="30"/>
								</td>
							</tr>
							</table>
						</fieldset>
			</div>
			<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
			</div>
					<div class="clr"></div>
				</div>

			</div>
			<input type="hidden" name="task" value="" />
			</form>

			<div class="clr"></div>

			<form enctype="multipart/form-data" action="index.php" method="post" name="filename" id="filename">

				<h2><jtmpl:translate key="loadSampleOrMigrate">Load Sample Data, Restore or Migrate Backed Up Content</jtmpl:translate></h2>
				<div class="install-text">
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS1</jtmpl:translate></p>
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS2</jtmpl:translate></p>
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS3</jtmpl:translate></p>
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS4</jtmpl:translate></p>
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS5</jtmpl:translate></p>
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS6</jtmpl:translate></p>
					<p><jtmpl:translate>LOADSQLINSTRUCTIONS7</jtmpl:translate></p>
				</div>
				<div class="install-body">
				<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
			</div>
			<div class="m">
						<fieldset>
							<table class="content2">
							<tr>
								<td width="5%"></td>
								<td width="25%"></td>
								<td width="70%"></td>
							</tr>
							<tr>
								<td>
									<input id="default_sample" type="radio" name="what_to_load" onclick="selectMode();"/>
								</td>
								<td>
									<label for="default_sample">
										<jtmpl:translate>Install default sample data</jtmpl:translate>
									</label>
								</td>
								<td>
									<em>
									<jtmpl:translate key="tipInstallDefault" />
									</em>
								</td>
							</tr>
							<tr>
								<td></td>
								<td colspan="2">
									<span id="theDefault"><input class="button" type="button" name="instDefault" value="<jtmpl:translate>clickToInstallDefault</jtmpl:translate>" onclick="JDefault();"/></span>
								</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td></td>
								<td></td>
							</tr>

							<tr>
								<td valign="top">
									<input id="migrate_sql" type="radio" name="what_to_load" onclick="selectMode();"/>
								</td>
								<td valign="top">
									<label for="migrate_sql">
										<jtmpl:translate key="migrateTitle">Load script</jtmpl:translate>
									</label>
								</td>
								<td>
									<em>
									<jtmpl:translate key="tipLoadMigration">The migration script needs to be created on the old site by the com_migrator tool or created manually to conform.</jtmpl:translate>
									</em>
									<br />
									<em>
									<jtmpl:translate key="tipLoadSql">Joomla! 1.5 Migration SQL scripts need to be Joomla 1.5 compatible and should have the appropriate table prefix.</jtmpl:translate>
									</em>

								</td>
							</tr>
							<jtmpl:tmpl name="uploadsize">
							<tr>
								<td></td>
								<td>
									<jtmpl:translate>Maximum Upload Size</jtmpl:translate>
								</td>
								<td>
									<p>{MAXUPLOAD}</p>
								</td>
							</tr>
							</jtmpl:tmpl>
							<tr>
								<td></td>
								<td>
									<label for="oldPrefix">
										<jtmpl:translate>Old table prefix</jtmpl:translate>
									</label>
								</td>
								<td>
									<input class="inputbox" type="text" id="oldPrefix" name="vars[oldPrefix]" value="" size="24" />
								</td>
							</tr>
							<tr>
								<td></td>
								<td>
									<label for="srcEncoding">
										<jtmpl:translate>Old site encoding</jtmpl:translate>
									</label>
								</td>
								<td>
									<!--<input class="inputbox" type="text" id="srcEncoding" name="vars[srcEncoding]" value="" size="24" />-->
									<select id="srcEncoding" name="vars[srcEncoding]" class="inputbox" >
									<jtmpl:tmpl name="encoding_options">
										<option value="{VALUE}" >{VALUE}</option>
									</jtmpl:tmpl>
									</select>
								</td>
							</tr>
							<tr>
								<td></td>
								<td valign="top">
									<label for="migration_script">
										<jtmpl:translate>Migration Script</jtmpl:translate>
									</label>
								</td>
								<td>
									<input class="input_box" id="migration_script" name="sqlFile" type="file" size="20"  />
									<br />
									<input class="input_box" id="sqlUploaded" name="sqlUploaded" type="checkbox" /><jtmpl:translate key="tipUploaded">I have already uploaded a SQL file</jtmpl:translate>
									<br />
									<input class="input_box" id="migration" name="migration" type="checkbox" /><jtmpl:translate key="tipMigration">This script is a Joomla! 1.0 migration script.</jtmpl:translate>
									<br />
									<input class="button" type="button" name="migrationLoad" value="<jtmpl:translate>Upload and execute</jtmpl:translate>" onclick="migrationSql(filename, 'migration');" />
									<br /><br />
									<span id="theMigrationResponse">{VAR_DIRCHECK} {VAR_MIGRESPONSE}</span>
								</td>
							</tr>

							</table>

						</fieldset>
					</div>
				<div class="b">
					<div class="b">
						<div class="b"></div>
					</div>
				</div>
			</div>
  			<input type="hidden" name="task" value="mainconfig" />
  			<input type="hidden" name="sqlupload" value="0" />
  			<input type="hidden" name="migrationupload" value="0" />
  			<input type="hidden" name="loadchecked" value="{VAR_LOADCHECKED}" />
  			<input type="hidden" name="dataLoaded" value="{VAR_DATALOADED}" />
  			<input type="hidden" name="DBtype" value="{VAR_DBTYPE}" />
  			<input type="hidden" name="DBhostname" value="{VAR_DBHOSTNAME}" />
  			<input type="hidden" name="DBuserName" value="{VAR_DBUSERNAME}" />
  			<input type="hidden" name="DBpassword" value="{VAR_DBPASSWORD}" />
  			<input type="hidden" name="DBname" value="{VAR_DBNAME}" />
  			<input type="hidden" name="DBPrefix" value="{VAR_DBPREFIX}" />
  			<input type="hidden" name="ftpRoot" value="{VAR_FTPROOT}" />
  			<input type="hidden" name="ftpEnable" value="{VAR_FTPENABLE}" />
  			<input type="hidden" name="ftpHost" value="{VAR_FTPHOST}" />
  			<input type="hidden" name="ftpPort" value="{VAR_FTPPORT}" />
  			<input type="hidden" name="ftpUser" value="{VAR_FTPUSER}" />
  			<input type="hidden" name="ftpPassword" value="{VAR_FTPPASSWORD}" />
  			<input type="hidden" name="lang" value="{VAR_LANG}" />
  			<input type="hidden" name="migstatus" value="{VAR_MIGSTATUS}" />
  		</form>


		<div class="clr"></div>
		</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
		</div>
	</div>
</div>

<div class="clr"></div>


<script language="JavaScript" type="text/javascript">
	document.filename.what_to_load[document.filename.loadchecked.value].checked = true;
	selectMode();
	if(this.document.filename.migstatus.value == '1') {
		this.document.filename.what_to_load.disabled = 1;
		this.document.filename.instDefault.disabled = 1;
		this.document.filename.default_sample.disabled = 1;
		this.document.filename.migrate_sql.disabled = 1;
	}
</script>
